using MicroMsg.Common.Utils;
using MicroMsg.Storage;
using System;
namespace MicroMsg.Manager
{
	public static class ChatMsgHelper
	{
		public static bool IsSender(this ChatMsg chatMsg_0)
		{
			return chatMsg_0.nIsSender > 0;
		}
		public static bool IsImage(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			int nMsgType = chatMsg_0.nMsgType;
			if (nMsgType <= 13)
			{
				if (nMsgType == 3 || nMsgType == 13)
				{
					return true;
				}
			}
			else
			{
				if (nMsgType == 23 || nMsgType == 33)
				{
					return true;
				}
				if (nMsgType == 39)
				{
					return true;
				}
			}
			return false;
		}
		public static bool IsCustomSmiley(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			int nMsgType = chatMsg_0.nMsgType;
			return nMsgType == 47;
		}
		public static bool IsVoice(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 34;
		}
		public static bool IsVideo(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 43;
		}
		public static bool IsTxt(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 1;
		}
		public static bool IsSysInfo(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 10000;
		}
		public static bool IsFmessage(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			if (chatMsg_0.nMsgType != 37)
			{
				if (chatMsg_0.nMsgType != 40)
				{
					return false;
				}
			}
			return true;
		}
		public static bool IsQQMailmessage(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 35;
		}
		public static bool isQmessageTxt(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 36;
		}
		public static bool IsPushMsg(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 38;
		}
		public static bool IsShareCard(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 42;
		}
		public static bool IsMap(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 48;
		}
		public static bool IsAppMsg(this ChatMsg chatMsg_0)
		{
			return chatMsg_0 != null && chatMsg_0.nMsgType == 49;
		}
		public static bool IsValidFmessage(this ChatMsg chatMsg_0)
		{
			return chatMsg_0.nMsgType == 37;
		}
		public static bool IsSupport(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			ContactMgr.UserType userType = ContactMgr.getUserType(chatMsg_0.strTalker);
			if (chatMsg_0.strTalker == "sysnotice")
			{
				return false;
			}
			if (userType != ContactMgr.UserType.UserTypeChatRoom && userType != ContactMgr.UserType.UserTypeNormal)
			{
				if (userType != ContactMgr.UserType.UserTypeQQ)
				{
					return userType == ContactMgr.UserType.UserTypeQQ || userType == ContactMgr.UserType.UserTypeBottle || (userType == ContactMgr.UserType.UserTypePlugin && (chatMsg_0.strTalker == "weixin" || (chatMsg_0.strTalker == "fmessage" && FMsgMgr.getFMsgType(chatMsg_0) == FMsgType.other) || chatMsg_0.strTalker == ConstantValue.TAG_BLOGAPP || chatMsg_0.strTalker == ConstantValue.TAG_NEWS || chatMsg_0.strTalker == ConstantValue.TAG_QQMAIL)) || chatMsg_0.IsPushMsg();
				}
			}
			return true;
		}
		public static bool IsSupportConversation(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			ContactMgr.UserType userType = ContactMgr.getUserType(chatMsg_0.strTalker);
			if (chatMsg_0.strTalker == "sysnotice")
			{
				return false;
			}
			if (userType == ContactMgr.UserType.UserTypeQQ)
			{
				return false;
			}
			if (userType == ContactMgr.UserType.UserTypeBottle)
			{
				return false;
			}
			if (userType != ContactMgr.UserType.UserTypeChatRoom && userType != ContactMgr.UserType.UserTypeNormal)
			{
				if (userType != ContactMgr.UserType.UserTypeQQ)
				{
					return userType == ContactMgr.UserType.UserTypePlugin && (chatMsg_0.strTalker == "weixin" || (chatMsg_0.strTalker == "fmessage" && FMsgMgr.getFMsgType(chatMsg_0) == FMsgType.other) || chatMsg_0.strTalker == ConstantValue.TAG_BLOGAPP || chatMsg_0.strTalker == ConstantValue.TAG_NEWS || chatMsg_0.strTalker == ConstantValue.TAG_QQMAIL);
				}
			}
			return true;
		}
		public static MsgUIStatus GetStatus(this ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return MsgUIStatus.Success;
			}
			if (chatMsg_0.IsTxt())
			{
				if (chatMsg_0.nIsSender != 1)
				{
					return MsgUIStatus.Success;
				}
				return (MsgUIStatus)chatMsg_0.nStatus;
			}
			else
			{
				if (!chatMsg_0.IsImage() && !chatMsg_0.IsCustomSmiley())
				{
					if (chatMsg_0.IsVoice())
					{
						return (MsgUIStatus)chatMsg_0.nStatus;
					}
					if (chatMsg_0.isQmessageTxt())
					{
						return (MsgUIStatus)chatMsg_0.nStatus;
					}
					if (chatMsg_0.IsVideo())
					{
						return (MsgUIStatus)chatMsg_0.nStatus;
					}
					return MsgUIStatus.Success;
				}
				else
				{
					if (chatMsg_0.nIsSender == 1)
					{
						return (MsgUIStatus)chatMsg_0.nStatus;
					}
					return MsgUIStatus.Success;
				}
			}
		}
		public static string getTalker(string toUserName, string fromUserName)
		{
			if (string.IsNullOrEmpty(toUserName) || string.IsNullOrEmpty(fromUserName))
			{
				DebugEx.debugBreak();
				return "";
			}
			if (AccountMgr.getCurAccount().strUsrName.Equals(toUserName))
			{
				return fromUserName;
			}
			return toUserName;
		}
	}
}
